import datetime
from google.appengine.ext import db
from google.appengine.tools import bulkloader

class PostalCode(db.Model):
  city = db.StringProperty()
  prov = db.StringProperty()
  geohash = db.StringProperty()
  #code = db.StringProperty()

class PostalCodeLoader(bulkloader.Loader):
  def __init__(self):
    bulkloader.Loader.__init__(self, 'PostalCode',
                               [('city', str),
                                ('prov', str),
                                ('geohash', str),
                                ('code', str)
                                ])

  def generate_key (self, i, values):
    # The postal code is the key name
    return values[3]

loaders = [PostalCodeLoader]